﻿using UnityEngine;
using System.Collections;

public enum CardTweenType
{
	None,
	iTween,
	LeanTween
}

public class IngameSetting : MonoBehaviour {
	
	private static IngameSetting instance;

	public static IngameSetting Instance{
		get{
			return instance;
		}
	}

    public static string[] CharColorName = new string[4]
    {
        "Blue",
        "Green",
        "Yellow",
        "Red"
    };

    public static int DefaultTurnTime = 0;

	void Awake()
	{
		instance = this;
	}
	
	public GameObject playerTagCirclePrefab;
	public Color [] p_color;
	public Material [] turnAlarmMat;
	
	
	public float DiceResultDelay = 0.5f;
	public float PopCardDelay = 0.5f;
	public float MoveBonusDelay = 0.5f;
	
	public CardTweenType cardTween = CardTweenType.iTween;
	//public float musicVolume = 1.0f;

	public float [] charTagOffset;
	public Texture [] diceTextures;
	public Texture [] fxPointerTexture;
	public int nDiceNormal=1;
	public int nDiceAttacker=7;
	public int nDiceDefender=3;
	public bool bChangeDiceTexture = true;
	public float digit2Offset = 0.076f;
	public Color GetPlayerColor(int gameOrder)
	{
		if(gameOrder-1<0 || gameOrder-1>=p_color.Length)
			return Color.white;
		return p_color[gameOrder-1];
	}

	public float GetCharOffset(int charID)
	{
		if(charID>0 && charID< charTagOffset.Length)
			return charTagOffset[charID];
		return 0;
	}

	public Texture GetDiceTexture(DiceShapeType diceShapeType)
	{
		if(diceShapeType==DiceShapeType.Attacker)
		{
			if(diceTextures[nDiceAttacker] == null)
				diceTextures[nDiceAttacker] = Resources.Load("Textures/DiceTextures/dice_0"+nDiceAttacker.ToString() ) as Texture;
			return diceTextures[nDiceAttacker];
		}
		else if(diceShapeType==DiceShapeType.Defender)
		{
			if(diceTextures[nDiceDefender] == null)
				diceTextures[nDiceDefender] = Resources.Load("Textures/DiceTextures/dice_0"+nDiceDefender.ToString() ) as Texture;
			return diceTextures[nDiceDefender];
		}
		if(diceTextures[nDiceNormal] == null)
			diceTextures[nDiceNormal] = Resources.Load("Textures/DiceTextures/dice_0"+nDiceNormal.ToString() ) as Texture;
		return diceTextures[nDiceNormal];
	}
}
